<?php

include( "./admin/include/func.php");

$doc = new DOMDocument();
$doc->formatOutput = true;

$u = $doc->createElement( "urlset" );

foreach ($rovatok as $rovat) {
	
	$r = $doc->createElement( "url" );

	$l = $doc->createElement( "loc" );
	
	//print "<p><a href='http://hirdetek.net/hirdetesek.php?rovat=" . $rovat['slug'] . "'>" . $rovat['slug'] . "</a></p>"; 

	$t = $doc->createTextNode( 'http://hirdetek.net/hirdetesek.php?rovat=' . $rovat['slug'] );

	$l->appendChild( $t ); 

	$r->appendChild( $l ); 

	$f = $doc->createElement( "changefreq" );

	$d = $doc->createTextNode( 'daily' );

	$f->appendChild( $d ); 

	$r->appendChild( $f ); 

	$u->appendChild( $r ); 
}

$doc->appendChild( $u ); 

/*  
foreach ($rovatok as $rovat) {

	$c = $doc->createElement( "url" );

	$loc = $doc->createElement( "location" );
	
	$loc->appendChild(
		$doc->createTextNode( 'http://hirdetek.net/hirdetesek.php?rovat=' . $rovat['slug'] )
	);
	
	$c->appendChild( $loc ); 
}
*/

$doc->saveXML();

$doc->save( "sitemap2.xml" ) 
  
?>
